﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KPI.UIBase
{
    public static class LocalDataExtend
    {

        public static string NumberToABC(this int num)
        {
            string columnString = "";
            decimal columnNumber = num;
            while (columnNumber >= 0)
            {
                decimal currentLetterNumber = (columnNumber) % 26;
                char currentLetter = (char)(currentLetterNumber + 65);
                columnString = currentLetter + columnString;
                columnNumber = (columnNumber - (currentLetterNumber + 1)) / 26;
            }
            return columnString;
        }


        public static List<int> ABCAsNumber(this string strABC)
        {
            List<int> listNumber = new List<int>();
            foreach (var item in strABC)
            {
                char currentLetter = (char)(item - 65);
                listNumber.Add(currentLetter);
            }
            return listNumber;
        }

    }
}
